
<script>
	
	inicio = (new Date()).getTime();
	
	var domReady = function(fn) {
		
		if (typeof fn !== 'function') return;
		var trigger = function() {fn.apply();};
		var isIE = /MSIE/i.test(navigator.userAgent);
		var isSafariKDE = /WebKit|Khtml/i.test(navigator.userAgent);
		var isOperalt9 =  window.opera && parseInt(window.opera.version()) < 9;
		
		if(document.addEventListener)
			document.addEventListener("DOMContentLoaded", trigger, false);
			
		if (isIE) (function(){
			var node = document.createElement("document:ready");
			try {
				node.doScroll('left');
				trigger();
				node = null;
			}
			catch(e) {
				setInterval(arguments.callee, 0);
			}
		})();
		
		if (isSafariKDE || isOperalt9) {
			var timer = setInterval(function() {
				if (/loaded|complete/.test(document.readyState)) {
					clearInterval(timer);
					trigger();
				}
			}, 0);
		}
	};


		
	domReady(function() {
		
		fim = (new Date()).getTime();
		log(fim-inicio +"ms");
		
		document.getElementById('2').innerHTML = "FUNCIONOU";
		document.getElementById('4990').innerHTML = "FUNCIONOU";
		
	});
	
	window.onload = function() {
		fim = (new Date()).getTime();
		log(fim-inicio +"ms - On load!");
	};
	
	
</script>



<script src="../asynx.js"></script>
<script src="../dom/dom.js"></script>
<script src="../impl/array.js"></script>
<script src="../impl/util.js"></script>
<script src="../impl/cookie.js"></script>
<script src="../impl/ajax.js"></script>
<script src="../impl/lang.js"></script>
<script src="../dom/xpath.js"></script>
<script src="../dom/selector.js"></script>
<script src="../event/event.js"></script>

<script src="../plugins/drag/drag.js"></script>
<script src="../plugins/animation/anim.js"></script>
<script src="../plugins/datalist/datalist.js"></script>
<script src="../plugins/autocomplete/autocomplete.js"></script>
<script src="../plugins/windows/windows.js"></script>

<h1>asynx DOMContentLoader</h1>

<div id="log">log<br></div>


<script>
	
	for (x=0;x<10;x++) { 
	domReady(function() {
		log("sdfsdf");
	});
	
	domReady(function() {
		log("sdfsdf");
	});
	}
	
</script>



<?

for ($x = 0; $x < 5000; $x++) {
	echo "<span id='$x'>a a</span>";
}

?>

<img src='http://costa.kofeina.net/uploads/soft/fedora5-screen01.png?14231323' width='200px' height="200px">


